package casa.depesos.app.com.dlg;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.common.base.utils.SPHelper;

import casa.depesos.app.com.App;
import casa.depesos.app.com.databinding.DlgKeep2Binding;
import casa.depesos.app.com.utils.Utils;

public class Keep2Dlg extends FullScreenDlg {

    DlgKeep2Binding binding;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        binding = DlgKeep2Binding.inflate(inflater, container, false);
        setCancelable(false);
        String max = SPHelper.getInstance(App.getApp()).getString("max", null);
        if (!TextUtils.isEmpty(max)) {
            String str = Utils.formatNoFloat(max, true);
            binding.max.setText(str);
            binding.ok.setText("Quiero " + str);
        }
        binding.ok.setOnClickListener(view -> dismiss(true, null));
        binding.cancel.setOnClickListener(view -> dismiss());

        return binding.getRoot();
    }
}
